package com.mach.platform.repository;

import com.mach.platform.domain.OrderFile;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface OrderFileRepo extends BaseRepository<OrderFile> {

    @Modifying
    @Query(value = "delete from order_file_form where file_name = ?1 and dir = ?2", nativeQuery = true)
    int deleteByFileNameAndFilePath(String name, String filePath);

    @Query(value = "select * from order_file_form where file_name like concat(?1,'%') and dir = ?2", nativeQuery = true)
    OrderFile getOrderFile(String fileName, String filePath);
}
